const classNames = require('classnames')
const _ = require('../utils')

_.create('avatar', {
  properties: {
    variant: {
      type: String,
    },
    size: {
      type: String,
      value: '80rpx',
    },
    alt: String,
    src: String,
    rounded: Boolean,
  },

  computed: {
    classes(data) {
      const { classPrefix, variant, rounded } = data
      const classes = classNames(classPrefix, {
        [`${classPrefix}-${variant}`]: variant,
        [`${classPrefix}-rounded`]: rounded,
      })

      return classes
    },

    styles(data) {
      const { size } = data

      if (!size) return ''

      return `width: ${size}; height: ${size}`
    },
  },

  methods: {},
})
